<!DOCTYPE html>
<html lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
<meta name="keywords" content="LightYear,LightYearAdmin,光年,后台模板,后台管理系统,光年HTML模板">
<meta name="description" content="Light Year Admin V5是一个基于Bootstrap v5.1.3的后台管理系统的HTML模板。">
<title>{:$configs['SYSTEM_NAME']}</title>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<link rel="stylesheet" type="text/css" href="__STATIC__/admin/css/materialdesignicons.min.css">
<link rel="stylesheet" type="text/css" href="__STATIC__/admin/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="__STATIC__/admin/css/style.min.css">
<!--日期选择器css-->
<link rel="stylesheet" type="text/css" href="__STATIC__/admin/js/bootstrap-datepicker/bootstrap-datepicker3.min.css">
<!--时间日期选择器css-->
<link rel="stylesheet" type="text/css" href="__STATIC__/admin/js/bootstrap-datetimepicker/bootstrap-datetimepicker.min.css">
<!--引入下拉插件css-->
<link href="__STATIC__/common/select2/select2.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="__STATIC__/admin/js/bootstrap-select/bootstrap-select.min.css">

<link rel="stylesheet" type="text/css" href="__STATIC__/common/cch.css">
</head>
  
<body>
<div class="container-fluid">
  
  <div class="row">
    
    <div class="col-lg-12">
      <div class="card">
        <div class="card-body">
          <div class="card-search mb-2-5">
            <form class="search-form" method="get" action="{:url('index')}" >
              
              {include file="html/search" /}
              
            </form>
          </div>
          <div class="card-btns mb-2-5">
            <a class="btn btn-primary me-1 search_btn" href="#!"><i class="mdi mdi-magnify"></i> 搜索</a>
          </div>
          <div class="table-responsive">
            <table class="table table-bordered">
              <thead>
                <tr>
                  <th>
                    <div class="form-check">
                      <input class="form-check-input" type="checkbox" id="check-all">
                      <label class="form-check-label" for="check-all"></label>
                    </div>
                  </th>
                  <th>用户类型</th>
                  <th>主账号</th>
                  <th>子账号</th>
                  <th>请求方法</th>
                  <th width="120px">请求路径</th>
                  <th>价格</th>
                  <th width="250px">请求Header</th>
                  <th width="250px">API链接</th>
                  <th width="250px">API Header</th>
                  <th width="250px">参数</th>
                  <th width="250px">返回结果</th>
                  <th width="100px">日期</th>
                </tr>
              </thead>
              <tbody>
                <?php if (empty($list)): ?>
                  <tr><td colspan="100" class="text-center">暂无数据</td></tr>
                <?php else: ?>
                  <?php foreach ($list['data'] as $k => $vo): ?>
                    <tr>
                      <td>
                        <div class="form-check">
                          <input type="checkbox" class="form-check-input ids" name="ids[]" value="{:$vo['id']}" id="ids-{:$vo['id']}">
                          <label class="form-check-label" for="ids-{:$vo['id']}"></label>
                        </div>
                      </td>
                      <td>{:$vo['utype_cn']}</td>
                      <td>{:$vo['user']['truename']}</td>
                      <td>{:$vo['ram_account']}</td>
                      <td>{:$vo['method']}</td>
                      <td>{:$vo['path']}</td>
                      <td>{:$vo['price']}</td>
                      <td>{:truncateString($vo['header'],50)}
                        <a class="btn btn-sm btn-default view_btn" data-id="{:$vo['id']}" data-type="header" href="javascript:void(0);" data-bs-toggle="modal" data-bs-target="#modal-view" title="详情"><i class="mdi mdi-eye"></i></a></td>
                      <td>{:$vo['api_url']}</td>
                      <td>{:truncateString($vo['api_header'],50)}
                        <a class="btn btn-sm btn-default view_btn" data-id="{:$vo['id']}" data-type="api_header" href="javascript:void(0);" data-bs-toggle="modal" data-bs-target="#modal-view" title="详情"><i class="mdi mdi-eye"></i></a></td>
                      <td>{:truncateString($vo['params'],50)}
                        <a class="btn btn-sm btn-default view_btn" data-id="{:$vo['id']}" data-type="params" href="javascript:void(0);" data-bs-toggle="modal" data-bs-target="#modal-view" title="详情"><i class="mdi mdi-eye"></i></a></td>
                      <td>{:truncateString($vo['api_result'],50)}
                        <a class="btn btn-sm btn-default view_btn" data-id="{:$vo['id']}" data-type="api_result" href="javascript:void(0);" data-bs-toggle="modal" data-bs-target="#modal-view" title="详情"><i class="mdi mdi-eye"></i></a></td>
                      <td>{:timeDef($vo['ctime'],'','Y-m-d')}</td>
                        
                 
                    </tr>
                  <?php endforeach ?>
                <?php endif ?>
              </tbody>
            </table>
          </div>

          {$page|raw}
          
          
        </div>
      </div>
    </div>
        
  </div>
  
</div>


<div class="modal" tabindex="-1" id="modal-view">
  <div class="modal-dialog modal-dialog-centered modal-xl">
    <div class="modal-content">
      <div class="modal-header">
        <h6 class="modal-title">详情</h6>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body" style="white-space: pre-line;">
        
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
      </div>
    </div>
  </div>
</div>


<div class="modal fade bs-example-modal-lg in" tabindex="-1" id="modal-tags">
  <div class="modal-dialog modal-xl modal-dialog-centered">
    <div class="modal-content">
      <div class="modal-header">
        <h6 class="modal-title" id="exampleModalLiveLabel">标签</h6>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body">
        <iframe src="" ></iframe>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
      </div>
    </div>
  </div>
</div>

<script type="text/javascript" src="__STATIC__/admin/js/jquery.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin/js/popper.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin/js/bootstrap.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin/js/main.min.js"></script>
<!--日期选择器js-->
<script type="text/javascript" src="__STATIC__/admin/js/bootstrap-datepicker/bootstrap-datepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin/js/bootstrap-datepicker/locales/bootstrap-datepicker.zh-CN.min.js"></script>
<!--时间日期选择器js-->
<script type="text/javascript" src="__STATIC__/admin/js/momentjs/moment.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin/js/bootstrap-datetimepicker/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin/js/momentjs/locale/zh-cn.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin/js/lyear-loading.js"></script><!-- loading -->
<!--引入下拉插件js-->
<script type="text/javascript" src="__STATIC__/common/select2/select2.js"></script>
<script type="text/javascript" src="__STATIC__/admin/js/bootstrap-select/bootstrap-select.min.js"></script>
<!--自定义扩展-->
<script type="text/javascript" src="__STATIC__/common/cch.js"></script>



<script type="text/javascript">
    // function updatePreview() {
    //     const markdownText = document.getElementById('markdownInput').value;
    //     const htmlContent = marked.parse(markdownText); // 关键转换步骤
    //     document.getElementById('preview').innerHTML = htmlContent;
    // }

    $('.view_btn').on('click',function(){
        var id = $(this).attr('data-id');
        var type = $(this).attr('data-type');
        $.ajax({
            url:'{:url("detail")}',
            data:{id:id,type:type},
            type:'post',
            dataType:'json',
            success:function(data){
              $("#modal-view .modal-body").html(data.data);
            }
        });
    });

    $(".tags_btn").on('click',function(){
        var news_id = $(this).attr('data-id');
        var url = "{:url('news_tag/index',[],'')}";
        url = url + '?news_id='+news_id;
        $("#modal-tags").find('iframe').attr('src',url);
    });
</script>

<script type="text/javascript">
    $('.btn-group button').on('click',function(){
        var type = $(this).attr('data-type');
        $('input[name="date_type"]').val(type);

        $('.btn-group button').attr('class','btn btn-default');
        $(this).attr('class','btn btn-success');
        if (type == 0) {
            $("#search_time").show();
        }else{
            $("#search_time").hide();
        }
    });

    $(function(){
      var date_type = $('input[name="date_type"]').val();
      if (date_type == 0) {
          $("#search_time").show();
      }else{
          $("#search_time").hide();
      }
    });
</script>
</body>
</html>